package com.erbao.runtimedataarea;

/**
 * @author CaoBaoYin
 * @since 2022/3/30 20:10
 */
public class TestLambda {

    public static void main(String[] args) {
        /*三种写法等价*/
        I i1 = C::n;
        I i2 = new I() {
            @Override
            public void m() {
                C.n();
            }
        };
        I i3 = ()->{
            C.n();
        };
        System.out.println(i1.getClass());
        System.out.println(i2.getClass());
        System.out.println(i3.getClass());
    }

    @FunctionalInterface
    public interface I {
        void m ();
    }

    public static class C {
        static void n () {
            System.out.println("C.n running");
        }
    }

}
